<template>
  <!-- 
    在这里可以发现，vue Router 的根路由（path: '/'）并不是VUE的根，
    path: '/' 其实也是指向了VUE根组件的子组件
  -->
  <div><router-view /></div>
</template>

<script>
export default {
  methods: {
    commitHW() {
      this.$store.commit("setClientHeight", document.body.clientHeight);
      this.$store.commit("setClientWidth", document.body.clientWidth);
    },
  },
  mounted() {
    this.$nextTick(() => {
      this.commitHW();
      window.onresize = () => {
        /**
         * 修复修改屏幕尺寸后没有计算滚动条占位问题
         */
        this.$nextTick(() => {
          this.commitHW();
        });
      };
    });
  },
};
</script>
<style>
*::-webkit-scrollbar {
  /*滚动条整体样式*/
  width: 6px;
  /*高宽分别对应横竖滚动条的尺寸*/
  height: 1px;
}

*::-webkit-scrollbar-thumb {
  /*滚动条里面深色条*/
  border-radius: 10px;
  box-shadow: inset 0 0 5px rgba(236, 236, 236, 0.1);
  background: #ccc;
}

*::-webkit-scrollbar-track {
  /*滚动条里面轨道*/
  box-shadow: inset 0 0 5px rgba(236, 236, 236, 0.1);
  border-radius: 10px;
  background: #ededed;
}

#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;
}

nav a {
  font-weight: bold;
  color: #2c3e50;
}

nav a.router-link-exact-active {
  color: #42b983;
}
</style>
